package com.job.zhaokaiqiang;

import java.util.Scanner;

/**
 * @author DELL
 * @version 1.0
 * @since 2022-07-08 19:50:33
 */
public class MyHelper {
    //成员变量
    private String name;
    private int age;
    private String zhuanye;

    //成员方法
    public void sayself()
    {
        System.out.println("我的名字是"+this.name+"我的年龄是"+this.age);
        System.out.println("我的专业是"+this.zhuanye);
    }
    public double shu(int[] shuzu1,int n)
    {
        int p;
        p=n/2;
        //System.out.println(p);
        int i,j,k;
        int temp;
        double sum=0;
        for(i=0;i<n-1;i++)
        {
            k=i;
            for(j=i+1;j<n;j++)
            {
                if(shuzu1[k]>shuzu1[j])
                {
                    k=j;
                }
            }
            if(i!=k)
            {
                temp=shuzu1[k];
                shuzu1[k]=shuzu1[i];
                shuzu1[i]=temp;
            }
        }
        for(i=0;i<9;i++)
        {
            System.out.println(shuzu1[i]);
        }
        for(i=0;i<n;i++)
        {
            sum+=shuzu1[i];
        }
        sum=sum/n;
        System.out.println("平均值是"+sum);
        System.out.println("中间值是"+shuzu1[p]);
        if(shuzu1[p]<sum)
        {
            return sum;
        }else
            return shuzu1[p];
    }
    //构造方法
    public MyHelper() {
    }
    public MyHelper(String name, int age, String zhuanye) {
        this.name = name;
        this.age = age;
        this.zhuanye = zhuanye;
    }
}
